<h1>Liste des zones</h1>

<table>
  <tr>
    <th>Nom</th>
    <th>Surface</th>
    <th>Parcelles</th>
  </tr>

<% for zone in @zones %>
  <tr>
    <td><b><%=h zone.name %></b></td>
    <td><b><%=h zone.surface %></b></td>
	<td></td>
    <td><%= link_to 'Show', zone %></td>
    <td><%= link_to 'Edit', edit_zone_path(zone) %></td>
    <td><%= link_to 'Destroy', zone, :confirm => 'Are you sure?', :method => :delete %></td>
  </tr>
	<% for parcelle in zone.parcelles %>
		<% zonetopa = Zonetopa.find_by(zone.id, parcelle.id) %>
	  <tr>
	    <td><%= pretty(zone.percent_of_parcelle(parcelle.id)) %> %</td>
	    <td><%=h zonetopa.value %></td>
	    <td><%= link_to parcelle.name, edit_parcelle_path(parcelle) %></td>
		<td></td>
		<td></td>
	  </tr>
	<% end %>
<% end %>
</table>

<br />

<%= link_to 'New zone', new_zone_path %>
